<title>申请列表</title>

<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a><cite>申请列表</cite></a>
    </div>
</div>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">申请列表</div>
                <div class="layui-card-body">
                    <table class="layui-hide" id="course-table-page" lay-filter="course-page"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    layui.use(['jquery', 'table'], function(){
        var $ = layui.$, form = layui.form,
            table = layui.table, admin = layui.admin,
            view = layui.view;
        var width = window.screen.availWidth > 600 ? 600 : window.screen.availWidth;
        var tablelns = table.render({
            elem: '#course-table-page'
            ,url: "/student/application"
            ,method: 'get'
            ,cols: [[
                {field:'id', width:'5%',  title: 'ID', align: 'center'}
                ,{field:'courseName', width:'15%', title:'课程名', align:'center'}
                ,{field:'description', width:'60%', title:'课程描述', align:'center'}
                ,{field:'teacher_name', width:'10%', title:'教师', align:'center'}
                ,{field:'status', width:'10%', title:'审核状态', align:'center', templet: function (d) {
                        switch (d.status) {
                            case 0:
                                return '待审核';
                            case 1:
                                return '通过';
                            case 2:
                                return '拒绝';
                        }
                    }}
            ]]
            ,page: true
            ,parseData: function(res) {
                return {
                    "status": res.status,
                    "message": res.message,
                    "total": res.data.total,
                    "list": res.data.content
                };
            }
            ,response: {
                statusName: 'status'
                ,statusCode: 200
                ,msgName: 'message'
                ,countName: 'total'
                ,dataName: 'list'
            }
        });

    });

    function time(time = +new Date()) {
        var date = new Date(time + 8 * 3600 * 1000); // 增加8小时
        return date.toJSON().substr(0, 19).replace('T', ' ');
    }

    //显示结果
    function showMsg(text) {
        layer.msg("<div style=\"padding: 20px 100px;\">"+ text + "</div>", {
            time: 8000, //8s后自动关闭
            btn: ['明白了'],
            shade: 0.3,
            yes: function (index, layero) {
                layer.close(index);
            }
        });
    }
</script>